<?php

namespace app\index\model;

use think\Model;
use think\model\concern\SoftDelete;

class Album extends Model
{
    use SoftDelete;
    protected $name = 'car_album'; //表名      默认类型
    protected $autoWriteTimestamp = true;
    // 定义时间戳字段名
    protected $dateFormat = 'Y/m/d H:i:s';
    protected $createTime = 'create_at';
    protected $updateTime = 'update_at';
    protected $deleteTime='delete_at';

    public function logInfo() {
        return $this->hasOne(AlbumAudioLogo::class, 'albumId', 'id');
    }

    public function firstInfo() {
        return $this->hasOne(AlbumAudio::class, 'superiorId', 'id')->order('sort asc')->order('create_at desc');
    }
}